
# a = [1,2,1,3,5,5]
# def func(a):
#     x = []
#     for i in a:
#         if i not in x:
#             x.append(i)
#     print(x)
# A = func(a)

# with open('text.txt','r',encoding='utf8') as f:
#     a = f.readlines()
#     print(a)
#     lst2 = []
#     for i in a:
#         a = i.split(',')
#         # print(a)
#         lst1=[]
#         for j in a:
#             c = int(j.strip(','))
#             print(c)
#
#             lst1.append(c)
#             print(lst1)
#         lst2.append(tuple(lst1))
#     print(lst2)



a = '(1+2)+(3+4)'
def func(a):
    lef = '('
    rig =')'
    lst_1=[]
    if a.count('(') == a.count(")"):
        for i in range(len(a)):
            if a[i] ==lef:
                lst_1.append(a[i])
            elif a[i] == rig:
                lst_1.remove('(')
        return True

    else:
        return False


A=func(a)
print(A)






































